<?php use_helper('Javascript') ?>

<script type="text/javascript" src="/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/js/jquery.treeview.js"></script>

<style type="text/css">
#ex1 {
    float:left;
    width:200px;
}
#ex2 {
    float:left;
    width:130px;
    padding-left:5px;
    margin-left:5px;
}
/* ------------ treeview ---------- */
.treeview, .treeview ul { 
	padding: 0;
	margin: 0;
	list-style: none;
}

.treeview ul {
	background-color: #fff;
	margin-top: 4px;
}

.treeview .hitarea {
	background: url(/treeview_img/treeview-default.gif) -64px -25px no-repeat;
	height: 16px;
	width: 16px;
	margin-left: -16px;
	float: left;
	cursor: pointer;
}
/* fix for IE6 */
* html .hitarea {
	display: inline;
	float:none;
}

.treeview li { 
	margin: 0;
	padding: 3px 0pt 3px 16px;
	list-style: none;
}

.treeview a.selected {
	background-color: #eee;
}

#treecontrol { margin: 1em 0; display: none; }

.treeview .hover { color: red; cursor: pointer; }

.treeview li { background: url(/treeview_img/treeview-default-line.gif) 0 0 no-repeat; }
.treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; }

.treeview .expandable-hitarea { background-position: -80px -3px; }

.treeview li.last { background-position: 0 -1766px }
.treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(/treeview_img/treeview-default.gif); }  
.treeview li.lastCollapsable { background-position: 0 -111px }
.treeview li.lastExpandable { background-position: -32px -67px }

.treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; }

.treeview-red li { background-image: url(/treeview_img/treeview-red-line.gif); }
.treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(/treeview_img/treeview-red.gif); } 

.treeview-black li { background-image: url(/treeview_img/treeview-black-line.gif); }
.treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(/treeview_img/treeview-black.gif); }  

.treeview-gray li { background-image: url(/treeview_img/treeview-gray-line.gif); }
.treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(/treeview_img/treeview-gray.gif); } 

.treeview-famfamfam li { background-image: url(/treeview_img/treeview-famfamfam-line.gif); }
.treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(/treeview_img/treeview-famfamfam.gif); } 


.filetree li { padding: 3px 0 2px 16px; }
.filetree span.folder, .filetree span.file { padding: 1px 0 1px 20px; display: block; }
.filetree span.folder { background: url(/treeview_img/folder.gif) 0 0 no-repeat; }
.filetree li.expandable span.folder { background: url(/treeview_img/folder-closed.gif) 0 0 no-repeat; }
.filetree span.file { background: url(/treeview_img/file.gif) 0 0 no-repeat; }
</style>


<!--  таблица корневых каталогов -->
<?php use_helper('Form');?>
<?php if(isset($width_check)):?>

<div id="ex1">
   
     <ul id="navigation<?php echo $folder_id?>" class="filetree">      
		<?php foreach($folders as $f): ?>
		
		<li class="closed">
		<?php if($f->hasChildren()):?>
		<span class="folder">
		  <?php echo $f ?>
		 <?php else: ?>
		 <span class="file">
  			  		<?php if(in_array($f->getId(),$arr)):?>
  			  		<?php echo checkbox_tag('material[mat2_folder_list][]',$f->getId(),true) ?>
					
					<?php else: ?>
                    <?php echo checkbox_tag('material[mat2_folder_list][]',$f->getId()) ?>
                    <?php endif ?>
		 <label for="material_mat2_folder_list_<?php echo $f->getId() ?>"><?php echo $f ?></label>
		 <?php endif ?>
		 </span>
		 
		<?php if($f->hasChildren()):?>
		<?php include_partial('zdFolder/item',array('arr'=>$arr,'f'=>$f, 'rem'=>$rem,'width_check'=>'yes', 'module'=>$module))?>
		<?php endif ?>
		
		<?php endforeach?>
	</ul>	
		
		 
</div>

<?php else: ?>


		<?php foreach($folders as $f): ?>
		<?php include_partial('zdFolder/item',array('f'=>$f, 'rem'=>$rem, 'module'=>$module))?>
		<?php endforeach?>
		

<?php endif ?>




  <script type="text/javascript">
$(document).ready(function(){
// ---- TREE -----
$("#browser").treeview();
$("#navigation<?php echo $folder_id?>").treeview({
  persist: "cookie",
  collapsed: true,
  animated : "fast",
  unique: true
});
// ---- TREE -----
});
</script>
  
  
 